home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / elk-2_0.lha / elk-2.0 / contrib / zelk / src-zlib / codeerror.c next >
Encoding:
C/C++ Source or Header  |  1992-10-17  |  1.2 KB  |  72 lines

  1. /* Zcodeerror.c zilla 23aug91 .
  2.  * keep in a separate file so programs can use routines in libz but
  3.  * define their own Zcodeerror.
  4.  * modified
  5.  * 28apr        bugfix in varargs version
  6.  * 22           apr ansiupdates
  7.  * 5mar         perror()
  8.  */
  9.  
  10. #include <theusual.h>
  11.  
  12. #if Evarargs
  13. # include <varargs.h>
  14. #endif
  15. #if Estdarg
  16. # include <stdarg.h>
  17. #endif
  18.  
  19.  
  20. #if !Eunix
  21. # define perror(msg)
  22. #endif
  23.  
  24. #if (Estdarg&&Evprintf)
  25. #define _Zcodeerror_def_
  26. proc Zcodeerror(char *msg,...)
  27. {
  28.     va_list ap;
  29.  
  30.     fflush(stdout);
  31.     perror("");
  32.     va_start(ap,msg);
  33.     fprintf(stderr,"CODEERROR: ");
  34.     vfprintf(stderr,msg,ap);
  35.     putc('\n',stderr);
  36.     va_end(ap);
  37.     abort();
  38. }
  39. #endif
  40.  
  41. #if (Evarargs&&Evprintf)
  42. #define _Zcodeerror_def_
  43. proc Zcodeerror(va_alist)
  44.  va_dcl
  45. {
  46.     va_list ap;
  47.     char *msg;
  48.     
  49.     fflush(stdout);
  50.     perror("");
  51.     va_start(ap);
  52.     msg = va_arg(ap,char *);
  53.     fprintf(stderr,"CODEERROR: ");
  54.     vfprintf(stderr,msg,ap);
  55.     putc('\n',stderr);
  56.     va_end(ap);
  57.     abort();
  58. }
  59. #endif
  60.  
  61. #ifndef _Zcodeerror_def_
  62. Zcodeerror(msg)
  63.   char *msg;
  64. {
  65.     fflush(stdout);
  66.     perror("");
  67.     fprintf(stderr,"CODEERROR: %s\n",msg);
  68.     abort();
  69. }
  70. #endif
  71. #undef _Zcodeerror_def_
  72.